<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <link rel="stylesheet" href="/css/layui.min.2.9.21.css">
  <link rel="stylesheet" href="/css/index.css">
</head>

<body>

  <div class="layui-row main">
    <div class="layui-col-sm2 layui-col-xs0"> </div>
    <div class="layui-col-sm8 layui-col-xs12">

      <div class="layui-bg-gray" style="padding: 16px;">
        <div class="layui-row layui-col-space15">
          <div class="layui-col-md12">
            <div class="layui-card">
              <div class="layui-card-header">分类</div>
              <div class="layui-card-body">
                <div>

                  <div class="layui-form-item">
                    <div class="layui-input-group">
                      <input type="text" placeholder="例如：https://manwass.cc" class="layui-input" id="seachValue">
                      <div class="layui-input-split layui-input-suffix" style="cursor: pointer;" id="seach">
                        <i class="layui-icon layui-icon-search"></i>
                      </div>
                    </div>
                  </div>

                  <div>
                    <p>▲这是漫蛙的走失页，请务必收藏，会不定时更新新网域：</p>
                    <a href="https://fuwt.cc/maKapG" target="_blank">链接</a> <br>
                    <a href="https://trello.com/b/NacDoP5n/manwa防走失" target="_blank">链接</a>

                    <p>▲这是大陆地区网域，会自动跳转最新的网域：</p>
                    <a href="https://fuwt.cc/mw666" target="_blank">链接</a>
                  </div>


                </div>
              </div>
            </div>
          </div>
        </div>
      </div>

      <div class="flow-demo" id="ID-flow-demo-manual"></div>

      <div id="demo-laypage-all2" style="text-align: center;"></div>

    </div>
    <div class="layui-col-sm2 layui-col-xs0"> </div>

  </div>

  <script src="/js/jquery.min.js"></script>
  <script src="/js/crypto-js.js"></script>
  <script src="/js/webp-hero.bundle.js"></script>
  <!-- 需要 main_load_img.js 来加载图片。且img标签的src为空才行,真实的图片地址在data-r-src属性中 -->
  <script src="/js/main_load_img.js"></script>
  <script src="/js/layui.min.2.9.21.js"></script>
  <script src="../js/axios.js"></script>
  <script>

    layui.use(function () {
      var layer = layui.layer;
      var form = layui.form;
      var table = layui.table;
      var util = layui.util;
      var flow = layui.flow;
      var laypage = layui.laypage;

      let getBase_url_value = '';
      // 搜索
      function searchFun() {
        let value = document.getElementById('seachValue').value.trim() || '';
        getBase_url_value = value;
        axios.get(`/updateBaseUrl?id=${1}&url=${value}`)
          .then(function (response) {
            let { data } = response;
            yanzheng()
          })
          .catch(function (error) {
            console.log(error);
          });
      }
      $('#seach').click(searchFun);
      document.getElementById('seachValue').addEventListener('keydown', function (event) {
        if (event.key === 'Enter' || event.keyCode === 13) { // 兼容旧浏览器
          event.preventDefault(); // 阻止默认行为（如表单提交）
          searchFun()
        }
      });

      function yanzheng() {
        axios.get(`/getBase_url`)
          .then(function (response) {
            let { data } = response;
            data.forEach(item => {
              if (item.base_url_id == 1 && item.base_url == getBase_url_value) alert('更改成功，值为：' + getBase_url_value);
              // else alert('xxxx  更改失败  xxx，旧的值为：' + getBase_url_value);
            })
          })
          .catch(function (error) {
            console.log(error);
            next('', false)
          });
      }

    });


  </script>
</body>

</html>